. use "G:\Mi unidad\Alvacast\SISTRAT 2019 (github)\Stata SER 2020\_CONS_C1_df_csv_pedido_SER2020_avance
> 6(ENE 2020).dta", clear

Presentation of SER 2020

22 Jan 2020

The following indices are preliminary results to be presented on SER 2020. We used a dataset in construction, in which many cases had to be discarded in order to produce valid estimates. However, we are working to rescue as much valid treatments and patients as possible.

We eliminate HASHs that only have been admitted once time.

. gen a_botar=.
(103,669 missing values generated)

. recode a_botar .=1 if dup==0 & duplicates_filtered==1
(a_botar: 58752 changes made)

. *siempre el primer tratamiento, si tiene más de uno
. recode a_botar .=1 if dup==1 & duplicates_filtered>1
(a_botar: 17832 changes made)

. ****drop unique cases
. drop if missing(a_botar)
(27,085 observations deleted)

. ****generate event if each hash has more than an admission
. gen event=0

. recode event 0=1 if dup>0
(event: 17832 changes made)

Then, we set the dataset as a survival time format, configured by years (365.25 days) and defined by the difference between the last date of discharge of the last treatment and the date of admission of the following treatment (person_days) along the datasets from 2010 to 2019.

. stset person_days, failure(event==1) scale(365.25) id(row)

                id:  row
     failure event:  event == 1
obs. time interval:  (person_days[_n-1], person_days]
 exit on or before:  failure
    t for analysis:  time/365.25

──────────────────────────────────────────────────────────────────────────────
     76,584  total observations
          0  exclusions
──────────────────────────────────────────────────────────────────────────────
     76,584  observations remaining, representing
     76,584  subjects
     17,832  failures in single-failure-per-subject data
 89,802.045  total analysis time at risk and under observation
                                                at risk from t =         0
                                     earliest observed entry t =         0
                                          last observed exit t =  11.91239

. stdescribe, weight

         failure _d:  event == 1
   analysis time _t:  person_days/365.25
                 id:  row

                                   ├────────────── per subject ──────────────┤
Category                   total        mean         min     median        max
──────────────────────────────────────────────────────────────────────────────
no. of subjects            76584   
no. of records             76584           1           1          1          1

(first) entry time                         0           0          0          0
(final) exit time                   1.172595    .0027379   .6105407   11.91239

subjects with gap              0   
time on gap if gap             0           .           .          .          .
time at risk           89802.045    1.172595    .0027379   .6105407   11.91239

failures                   17832    .2328424           0          0          1
──────────────────────────────────────────────────────────────────────────────
. egen sum_0 = total(person_days) if event==0
(17832 missing values generated)

. egen sum_1 = total(person_days) if event==1
(58752 missing values generated)

. egen sum_tot = total(person_days)

. codebook sum_0 sum_1 sum_tot

───────────────────────────────────────────────────────────────────────────────────────────────────────
sum_0                                                                                       (unlabeled)
───────────────────────────────────────────────────────────────────────────────────────────────────────

                  type:  numeric (float)

                 range:  [12996586,12996586]          units:  1
         unique values:  1                        missing .:  17,832/76,584

            tabulation:  Freq.  Value
                        58,752  12996586
                        17,832  .

───────────────────────────────────────────────────────────────────────────────────────────────────────
sum_1                                                                                       (unlabeled)
───────────────────────────────────────────────────────────────────────────────────────────────────────

                  type:  numeric (float)

                 range:  [19803612,19803612]          units:  1
         unique values:  1                        missing .:  58,752/76,584

            tabulation:  Freq.  Value
                        17,832  19803612
                        58,752  .

───────────────────────────────────────────────────────────────────────────────────────────────────────
sum_tot                                                                                     (unlabeled)
───────────────────────────────────────────────────────────────────────────────────────────────────────

                  type:  numeric (float)

                 range:  [32800196,32800196]          units:  1
         unique values:  1                        missing .:  0/76,584

            tabulation:  Freq.  Value
                        76,584  32800196

. tab _d if _d==1

       1 if │
 failure; 0 │
if censored │      Freq.     Percent        Cum.
────────────┼───────────────────────────────────
          1 │     17,832      100.00      100.00
────────────┼───────────────────────────────────
      Total │     17,832      100.00

. di 

We calculated the failures in single-failre-per-subject data, divided by the total analysis time at risk and under observation. The cumulative incidence rate of readmission was 198.6 (per 1,000 patients/year).

Incidence Rate

We recoded the variables of cause of discharge, in order to account for early widthdrawal and late widthdrawal.

. recode motivodeegreso     (1=.  ) ///
>                     (2=3  "Alta Administrativa") ///
>                     (3=4 "Alta Terapéutica") ///
>                     (4=5 "Derivación"), gen(mot_egreso_rec)
(76583 differences between motivodeegreso and mot_egreso_rec)

. recode mot_egreso_rec .=1 if earlywdl==1
(mot_egreso_rec: 12766 changes made)

. recode mot_egreso_rec .=2 if earlywdl==0
(mot_egreso_rec: 27783 changes made)

. 
. label define mot_egreso_rec 1 "Abandono Temprano", modify

. label define mot_egreso_rec 2 "Abandono Tardio", modify

. 
. recode mot_egreso_rec (4=0 "Alta Terapéutica") ///
>                   (1=1 "Abandono Temprano") (else=.), gen(mot_egres_earlywdl)
(63715 differences between mot_egreso_rec and mot_egres_earlywdl)

. tab mot_egreso_rec mot_egres_earlywdl, miss

                    │ RECODE of mot_egreso_rec (RECODE
          RECODE of │        of motivodeegreso)
     motivodeegreso │ Alta Tera  Abandono           . │     Total
────────────────────┼─────────────────────────────────┼──────────
  Abandono Temprano │         0     12,766          0 │    12,766 
    Abandono Tardio │         0          0     27,783 │    27,783 
Alta Administrativa │         0          0      6,839 │     6,839 
   Alta Terapéutica │    17,552          0          0 │    17,552 
         Derivación │         0          0     11,541 │    11,541 
                  . │         0          0        103 │       103 
────────────────────┼─────────────────────────────────┼──────────
              Total │    17,552     12,766     46,266 │    76,584 

. 
. recode mot_egreso_rec (4=0 "Alta Terapéutica") ///
>                   (2=1 "Abandono Tardío") (else=.), gen(mot_egres_latewdl)
(76481 differences between mot_egreso_rec and mot_egres_latewdl)

. tab mot_egreso_rec mot_egres_latewdl, miss

                    │ RECODE of mot_egreso_rec (RECODE
          RECODE of │        of motivodeegreso)
     motivodeegreso │ Alta Tera  Abandono           . │     Total
────────────────────┼─────────────────────────────────┼──────────
  Abandono Temprano │         0          0     12,766 │    12,766 
    Abandono Tardio │         0     27,783          0 │    27,783 
Alta Administrativa │         0          0      6,839 │     6,839 
   Alta Terapéutica │    17,552          0          0 │    17,552 
         Derivación │         0          0     11,541 │    11,541 
                  . │         0          0        103 │       103 
────────────────────┼─────────────────────────────────┼──────────
              Total │    17,552     27,783     31,249 │    76,584 

The following figures shows the Kaplan-Meier estimates for the risk of experiencing readmission in the study period. Compared with those with therapeutic discharge, it was 2.85 [IC95% 2.69- 3.01] times higher among people with early withdraw, 1.72 [CI95% 1.64- 1.80] higher among people with late withdraw.

. sts graph, by (mot_egres_earlywdl) ci title("Proportion Experiencing Readmission to" "SUD Treatment b
> y cause of Discharge") /// 
> subtitle("Kaplan Meier w/ Confidence Intervals 95%") ///
> ylabel(0 "0" .2 "20" .6 "60" .8 "80" 1 "100") ///
> risktable(, size(*.5) order(1 "Therapeutic Discharge" 2 "Early Withdraw")) ///
> ytitle("Prob. of Being Readmitted") ylabel(#8) ///
> xtitle("Years Follow-up") xlabel(#8) ///
> note("Source: FONDECYT 1191282, SENDA's SUD Treatments period 2010-2019") ///
> legend(rows(3)) ///
> legend(cols(4)) ///
> graphregion(color(white) lwidth(large)) bgcolor(white) ///
> plotregion(fcolor(white)) graphregion(fcolor(white) ) ///
> legend(order(1 "95% CI Therapeutic Discharge" 2 "Therapeutic Discharge" 3 "95% CI Early Withdraw" 4 "
> Early Withdraw")size(*.5)region(lstyle(none)) region(c(none)) nobox) 

         failure _d:  event == 1
   analysis time _t:  person_days/365.25
                 id:  row
(note:  named style large not found in class linewidth, default attributes used)
(note:  linewidth not found in scheme, default attributes used)
(note:  named style large not found in class linewidth, default attributes used)
(note:  linewidth not found in scheme, default attributes used)

>

. sts graph, by (mot_egres_latewdl) ci title("Proportion Experiencing Readmission to" "SUD Treatment by
>  cause of Discharge") /// 
> subtitle("Kaplan Meier w/ Confidence Intervals 95%") ///
> ylabel(0 "0" .2 "20" .6 "60" .8 "80" 1 "100") ///
> risktable(, size(*.5) order(1 "Therapeutic Discharge" 2 "Late Withdraw")) ///
> ytitle("Prob. of Being Readmitted") ylabel(#8) ///
> xtitle("Years Follow-up") xlabel(#8) ///
> note("Source: FONDECYT 1191282, SENDA's SUD Treatments period 2010-2019") ///
> legend(rows(3)) ///
> legend(cols(4)) ///
> graphregion(color(white) lwidth(large)) bgcolor(white) ///
> plotregion(fcolor(white)) graphregion(fcolor(white) ) ///
> legend(order(1 "95% CI Therapeutic Discharge" 2 "Therapeutic Discharge" 3 "95% CI Late Withdraw" 4 "L
> ate Withdraw")size(*.5)region(lstyle(none)) region(c(none)) nobox)

         failure _d:  event == 1
   analysis time _t:  person_days/365.25
                 id:  row
(note:  named style large not found in class linewidth, default attributes used)
(note:  linewidth not found in scheme, default attributes used)
(note:  named style large not found in class linewidth, default attributes used)
(note:  linewidth not found in scheme, default attributes used)

>

We recoded the variables of main type of drug, in order to account for the main substance and comparisons between them: Cocaine vs. Alcohol, Cocaine Paste vs. Alcohol, and Marihuana vs. Alcohol.

. recode droga (1=1  "Cocaina") ///
>          (2=2  "Alcohol") ///
>          (3=3 "Marihuana") ///
>          (7=4 "Pasta Base") ///
>          (4 5 6 8 9 10=5 "Otros"), gen(droga_rec)
(31980 differences between droga and droga_rec)

. 
. recode droga (1=1  "Cocaina") ///
>          (2=0 "Alcohol" ) ///
>          (3=. ) ///
>          (7=. ) ///
>          (4 5 6 8 9 10=. ), gen(droga_rec_coc)
(62198 differences between droga and droga_rec_coc)

. recode droga (1=.  ) ///
>          (2=0  "Alcohol") ///
>          (3=. ) ///
>          (7=1 "Pasta Base") ///
>          (4 5 6 8 9 10=. ), gen(droga_rec_pbase)
(76584 differences between droga and droga_rec_pbase)

. recode droga (1=.  ) ///
>          (2=0 "Alcohol") ///
>          (3=1 "Marihuana") ///
>          (7=. ) ///
>          (4 5 6 8 9 10=. ), gen(droga_rec_mar)
(76584 differences between droga and droga_rec_mar)

The following figures shows the Kaplan-Meier estimates for the risk of experiencing readmission in the study period. Compared with those with alcohol as the main substance at admission, the cumulative incidence rate of readmission was 1.28 [IC95% 1.22- 1.34] times higher for those using cocaine, 1.53 [IC95% 1.47- 1.58] times higher for those using cocaine paste, but there were not important differences for those using marijuana (1.03 [IC95% 0.96- 1.10]).

         failure _d:  event == 1
   analysis time _t:  person_days/365.25
                 id:  row
(note:  named style large not found in class linewidth, default attributes used)
(note:  linewidth not found in scheme, default attributes used)
(note:  named style large not found in class linewidth, default attributes used)
(note:  linewidth not found in scheme, default attributes used)
         failure _d:  event == 1
   analysis time _t:  person_days/365.25
                 id:  row
(note:  named style large not found in class linewidth, default attributes used)
(note:  linewidth not found in scheme, default attributes used)
(note:  named style large not found in class linewidth, default attributes used)
(note:  linewidth not found in scheme, default attributes used)
         failure _d:  event == 1
   analysis time _t:  person_days/365.25
                 id:  row
(note:  named style large not found in class linewidth, default attributes used)
(note:  linewidth not found in scheme, default attributes used)
(note:  named style large not found in class linewidth, default attributes used)
(note:  linewidth not found in scheme, default attributes used)

> > >

Time outside treatment

To calculate the average time outside treatment, we needed to drop cases with only one treatment and keep those with more than one treatment.

(103,669 missing values generated)

(a_botar: 58752 changes made)

(58,752 observations deleted)

Then, we needed to order the dataset by HASHs and date of admission and date of discarge, and replace the date of discharge if it is greater than the next date of admission.

(43,764 missing values generated)

(1153 real changes made)

Finally, we get the difference between the most recent date of admission and the next date of discharge (or lagged date).

(17,832 missing values generated)

As can be seen in the following figure, days between treatments among patients tend to group from 0 to 1000 days, but with a sustained decrease starting from 500 days.

(bin=44, start=3, width=95.659091)

(17,832 observations deleted)

Mean estimation                   Number of obs   =     27,085

─────────────┬────────────────────────────────────────────────
             │       Mean   Std. Err.     [95% Conf. Interval]
─────────────┼────────────────────────────────────────────────
  span_treat │   784.9074    3.73449      777.5876    792.2272
─────────────┴────────────────────────────────────────────────

>

The average treatment span between treatment was 2.15 years, for every event in the dataset. However. Considering the question was made focusing in those readmitted to treatment, we needed to collapse the dataset by HASHs.

Mean estimation                     Number of obs   =     17,832

───────────────┬────────────────────────────────────────────────
               │       Mean   Std. Err.     [95% Conf. Interval]
───────────────┼────────────────────────────────────────────────
avg_span_treat │    848.724   4.587316      839.7324    857.7155
───────────────┴────────────────────────────────────────────────

Summarising by HASHs, the average treatment span between treatments among the readmitted (17832) in years is around 2.32 years.